package com.pmcc.core.web;

import com.pmcc.core.service.CityService;
import com.pmcc.utils.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by spurs on 2018/3/26.
 */
@RestController()
@RequestMapping("api/v1/city")
@Api(value = "CityController", description = "省市县区" )
public class CityController {
    @Autowired
    CityService cityService;
    /**
     * 查询国家列表
     */
    @ApiOperation(value="根据ID查询", httpMethod="GET",notes="根据id查找", response = ResultBean.class)
    @GetMapping("queryCountryCombo")
    public ResultBean queryCountryCombo() {
        return cityService.queryCountryCombo();
    }
    /**
     * 查询省
     */
    @ApiOperation(value="根据ID查询", httpMethod="GET",notes="根据id查找", response = ResultBean.class)
    @GetMapping("queryProvinceCombo")
    public ResultBean queryProvinceCombo(@ApiParam(required =true, name ="ID", value ="id")String id) {
        return cityService.queryProvinceCombo(id);
    }
    /**
     * 查询市
     */
    @ApiOperation(value="根据ID查询", httpMethod="GET",notes="根据id查找", response = ResultBean.class)
    @GetMapping("queryCityCombo")
    public ResultBean queryCityCombo(@ApiParam(required =true, name ="ID", value ="id")String id) {
        return cityService.queryCityCombo(id);
    }
    /**
     * 查询区
     */
    @ApiOperation(value="根据ID查询", httpMethod="GET",notes="根据id查找", response = ResultBean.class)
    @GetMapping("queryAreaCombo")
    public ResultBean queryAreaCombo(@ApiParam(required =true, name ="ID", value ="id")String id) {
        return cityService.queryAreaCombo(id);
    }
}
